/**
 * Created by dell on 2018/6/19.
 */
function huaDong(){
    var content_ul = document.getElementById("content_ul");
    var content_div = document.getElementById("content_div");
    var content_lis = content_ul.getElementsByTagName("li");
    var content_spans = content_div.getElementsByTagName("span");


    content_lis[0].style.display="block";

    function changPic(curIndex){
        for(var i=0;i<content_lis.length;i++){
            content_lis[i].style.display="none";
            content_spans[i].className="";
        }
        content_lis[curIndex].style.display="block";
        content_spans[curIndex].className="on";
    }
    for(var i=0;i<content_spans.length;i++){
            content_spans[i].index =i;
            content_spans[i].onclick=function(){
                var yc =this.index;
                changPic(yc);
            }
    }
}
huaDong();
var  jiaBtn = document.getElementById("jiaBtn");
var  jianBtn = document.getElementById("jianBtn");
var  num = document.getElementById("num");
var price1 = document.getElementById("price1");
var price = price1.innerHTML;
var pri = Number(price);
var total1 = document.getElementById("total1");

jiaBtn.onclick = function(){
    var shu = Number(num.value) // 获取 文本框的 value属性

    num.value =  shu + 1 ;
    total1.innerHTML = pri*Number(num.value);
}
jianBtn.onclick = function(){
    var shu = Number(num.value);
    num.value = shu-1;
    total1.innerHTML = pri*Number(num.value);
    if(num.value <= 1){
        num.value = 1
        total1.innerHTML = pri*Number(num.value);
    }
}

total1.innerHTML = pri*Number(num.value);




